﻿using System;



class RabbitProblem

{

    static void Main()

    {

        Console.WriteLine("兔子繁殖问题（斐波那契数列）");

        Console.Write("请输入要计算的月数：");



        int months;

        while (!int.TryParse(Console.ReadLine(), out months) || months <= 0)

        {

            Console.Write("输入无效，请输入一个正整数：");

        }



        Console.WriteLine("\n月份\t兔子对数");

        Console.WriteLine("   ");



        for (int i = 1; i <= months; i++)

        {

            long pairs = Fibonacci(i);

            Console.WriteLine($"{i}\t{pairs}");

        }

    }

    static long Fibonacci(int n)

    {

        if (n <= 2)

            return 1;

        return Fibonacci(n - 1) + Fibonacci(n - 2);

    }

    static long FibonacciIterative(int n)

    {

        if (n <= 2)

            return 1;



        long a = 1, b = 1, result = 0;

        for (int i = 3; i <= n; i++)

        {

            result = a + b;

            a = b;

            b = result;

        }

        return result;

    }

}